window.onpopstate = function (e) {
    console.log(e.state);
};
Array.prototype.forEach.call(document.getElementsByTagName('a'), function (v, i) {
    v.addEventListener('click', function (e) {
        e.preventDefault();

        var url = this.href,
            title = this.textContent,
            state = {
                title: title,
                url: url
            };
        console.log(state);
        history.pushState(state, null, url);
    });
});

